#coding:gbk

import struct

def bytes2str(bytes):
    return ' '.join(["%02X" %ord(x) for x in bytes])

def int2bytes(n):
    return struct.pack('>L', n)

def bytes2int(bytes):
    return struct.unpack('>L', bytes)[0]

def main():
    print bytes2str(''.join([chr(i) for i in range(0x10)]))
    print bytes2str(int2bytes(0x12345678))
    print hex(bytes2int('\x12\x34\x56\x78'))

if __name__ == '__main__':
    main()

